<?php


namespace App\Transformers\Live;


use App\Models\LiveAnchor;
use League\Fractal\TransformerAbstract;

class LiveAnchorTransformer extends TransformerAbstract
{
    public function transform(LiveAnchor $data)
    {
        return [
            'id' => $data->id,
            'name' => $data->name ?? "",
            'phone' => $data->phone ?? "",
            'avatar' => $data->avatar ?? "",
            'avatar_url' => 'https://placeimg.com/640/480/any',
            'wechat' => $data->wechat ?? "",
            'is_show' => $data->is_show ?? 0,
            'deleted_at' => $data->deleted_at ? $data->deleted_at->format("Y-m-d H:i:s") : "",
            'created_at' => $data->created_at ? $data->created_at->format("Y-m-d H:i:s") : "",
            'updated_at' => $data->updated_at ? $data->updated_at->format("Y-m-d H:i:s") : "",
        ];
    }

}
